<template>
  <div
    style="
      display: flex;
      justify-content: center;
      flex-direction: column;
      align-items: center;
    "
  >
    <van-icon
      name="checked"
      size="0.6rem"
      style="margin-top: 50%; color: #4f82ef"
    />
    <div style="color: #4e86e1; font-size: 0.3rem; margin-top: 0.2rem">
      人脸认证{{ result ? "成功" : "失败" }}!
    </div>
    <div
      style="color: #676767; font-size: 0.2rem; margin-top: 0.2rem"
      v-if="result"
    >
      已为您申请了数字证书
    </div>
    <van-button
      type="primary"
      @click="sendMessage"
      style="margin-top: 0.4rem; width: 64%"
      >完成</van-button
    >
  </div>
</template>

<script>
import { getResult } from "@/api/authentication";
export default {
  name: "aiqian",
  data() {
    return {
      result: false,
    };
  },
  methods: {
    getResultFun() {
      getResult({
        bizId: this.$route.query.bizId,
      })
        .then((res) => {
          console.log(res);
          this.result = res.code === 200;
        })
        .catch((error) => {
          // this.countdown = 0;
          // this.sendCodeClicked = true;
        });
    },
    sendMessage() {
      console.log("sendMessage");
      uni.webView.postMessage({
        data: {
          message: { getResult: this.result },
        },
      });
    },
  },
  created() {
    this.getResultFun();
  },
};
</script>

<style></style>
